#include <iostream>
using namespace std;
int main()
{
	int a,b,c,d;
	int e,f;
	cin>>a>>b>>c>>d;
	e =c-a;
	f =d-b;
	if (f<0)
	{
		e =e-1;
		f =60+d-b;
		cout<<e<<" "<<f<<endl;
	}
	else cout<<e<<" "<<f<<endl;
	return 0;
}
